package net.lzzy.datasetsql;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class StudentSQLThree {
    public static void main(String[] args) {
        SparkSession sparkSession = SparkSession.builder()
                .appName(StudentSQLThree.class.getName())
                .master("local")
                .getOrCreate();
        Dataset<Row> json = sparkSession.read().json("src/new_student.json");
        Dataset<Row> json2 = json.select("name", "age", "sex");
        json2.where("name rlike '^A.*' and (age = 20 or sex='Ů')").show();
        json2.where("name like 'A%' and (age = 20 or sex='Ů')").show();
    }
}
